import { resultPageSuccess, resultSuccess } from "mock/_util";
import { MockMethod } from "vite-plugin-mock";

function getLessonPlanList() {
  const list: any[] = [];
  for (let i = 0; i < 30; i++) {
    list.push({
      planId: i,
      designIdea: "设计思路-----" + i,
      docLink: "http://localhost:3100/static/upload/favicon.ico",
      groupEvaluation: "小组评价————" + i,
      personalSummary: "个人总结————" + i,
      startDate: "2022-08-26",
      subjectName: "课题名称————" + i,
      subjectType: "课题类型1",
      teachingProcess: `教学过程巴拉巴拉${i}`,
    });
  }
  return list;
}

export default [
  {
    url: "/dev-api/lessonPlan/page",
    timeout: 100,
    method: "get",
    response: ({ query }) => {
      const { pageNum = 1, pageSize = 10 } = query;
      return resultPageSuccess(pageNum, pageSize, getLessonPlanList());
    },
  },
  {
    url: "/dev-api/lessonPlan/page/:userId",
    timeout: 100,
    method: "get",
    response: ({ query }) => {
      const { pageNum = 1, pageSize = 10 } = query;
      return resultPageSuccess(pageNum, pageSize, getLessonPlanList());
    },
  },
  {
    url: "/dev-api/lessonPlan/setRemark/:userId/:planId",
    timeout: 100,
    method: "put",
    response: () => {
      return resultSuccess({});
    },
  },
] as MockMethod[];
